﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace TankIt
{
    class Bullet
    {

        Vector2 position;
        Vector2 speed;
        Texture2D texture;
        float rotation;
        Vector2 center;
        public BoundingSphere bb;

        public Bullet(Vector2 pos,Texture2D textura,float rotation,Vector2 speed )
        {
            position = pos;
            texture = textura;
            this.rotation=rotation;
            center=new Vector2(texture.Width / 2, texture.Height / 2);
            this.speed = speed;
            bb = new BoundingSphere(new Vector3(position.X,position.Y,0),10f);
        }

        public Vector2 getPositionExplosion(){
            return position-new Vector2(32,32);
        }

        public void draw(SpriteBatch batch)
        {
            batch.Draw(texture, position, null, Microsoft.Xna.Framework.Color.White, rotation, center, 1.0f, SpriteEffects.None, 0f);
        }

        public void update(GameTimerEventArgs e)
        {
            position += speed * (float)e.ElapsedTime.TotalSeconds;
            bb.Center.X = position.X;
            bb.Center.Y=position.Y;
        }
    }


}
